#ifndef _ParamManager
#define _ParamManager

#include <windows.h>	// CreateMutex, ReleaseMutex, HANDLE


namespace tlnet {

struct Param {
	char *data;
	char *value;

	Param *prev, *next;
};

class ParamManager {
public:
	Param *head, *tail, *curr;
	char _default[2];
	bool isOverwrite;
	HANDLE mutex;		// required to make thread safe

	// Constructor
	ParamManager(void);
	// Deconstructor
	~ParamManager(void);
	
	// Set whether to overwrite a data with the same name or not
	void setOverwrite(bool /*isOverwrite*/);

	// Returns whether the data is set or not
	bool isSet(char* /*data*/);
	// Returns whether the data/value pair is set or not
	bool isMatch(char* /*data*/, char* /*value*/);

	// set a new data/value pair
	bool set(char* data, char* value);
	// get a data's value, returns "" if the data does not exist
	char* get(char* /*data*/);
	// del a specified data
	bool del(char* /*data*/);

	// load up the passed in parameter string
	bool init(char* /*params*/, char* /*delim*/);
	// clear out the currently stored data
	bool clear(void);

	// get next param
	Param* getNext(void);
	// reset getNext() back to first node
	void reset(void);

	// return number of param items
	int getCount(void);
};

}

#endif // _ParamManager